<template>
	<view>
		<view class="userinfo">
			<view class="right">
				<image class="round" @click="pageTo('./detail')" :src="user.avatar"></image>
			</view>
			<view class="left">
				<view class="row01">
					<text class="name" @click="pageTo('./finishzl')">{{user.shop.merchantName}}</text>
				</view>
				<view class="row02">
					<text
						class="zhiwei">{{user.shop.provinceName}}{{user.shop.cityName}}{{user.shop.areaName}}{{user.shop.address}}</text>
				</view>
					
			</view>
		</view>
		<view class="cellboxList">
			<view class="cellbox">
				<view class="cellbox-item" @click="pageTo('./detail')">
					<image class="lefticon" mode="aspectFit" src="../../static/usercenter/wdzl-icon.png"></image>
					<text class="text">我的资料</text>
					<image class="righticon" mode="aspectFill" src="../../static/usercenter/icon_zk.png"></image>
				</view>
				<view class="cellbox-item" @click="pageTo('./myTechnician')">
					<image class="lefticon" mode="aspectFit" src="../../static/usercenter/wdjs-icon.png"></image>
					<text class="text">我的技师</text>
					<image class="righticon" mode="aspectFill" src="../../static/usercenter/icon_zk.png"></image>
				</view>
				<view class="cellbox-item" @click="pageTo('./myorder')">
					<image class="lefticon" mode="aspectFit" src="../../static/usercenter/wddd-icon.png"></image>
					<text class="text">我的订单</text>
					<image class="righticon" mode="aspectFill" src="../../static/usercenter/icon_zk.png"></image>
				</view>
				<view class="cellbox-item" @click="pageTo('../product/orderList')">
					<image class="lefticon" mode="aspectFit" src="../../static/usercenter/wddd-icon.png"></image>
					<text class="text">我的商城订单</text>
					<image class="righticon" mode="aspectFill" src="../../static/usercenter/icon_zk.png"></image>
				</view>

			</view>
			<view class="cellbox">
				<view class="cellbox-item" @click="pageTo('./applicationInfo')">
					<image class="lefticon" mode="aspectFit" src="../../static/usercenter/ypxx-icon.png"></image>
					<text class="text">应聘信息</text>
					<image class="righticon" mode="aspectFill" src="../../static/usercenter/icon_zk.png"></image>
				</view>
				<view class="cellbox-item" @click="pageTo('./statistics2')">
					<image class="lefticon" mode="aspectFit" src="../../static/usercenter/sytj-icon.png"></image>
					<text class="text">返利统计</text>
					<image class="righticon" mode="aspectFill" src="../../static/usercenter/icon_zk.png"></image>
				</view>


			</view>
			<view class="cellbox" v-if="user.admin == 1">
				<view class="cellbox-item" @click="pageTo('./shopList')">
					<image class="lefticon" mode="aspectFit" src="../../static/usercenter/wddd-icon.png"></image>
					<text class="text">我的店铺列表</text>
					<image class="righticon" mode="aspectFill" src="../../static/usercenter/icon_zk.png"></image>
				</view>
				<view class="cellbox-item" @click="pageTo('./adminList')">
					<image class="lefticon" mode="aspectFit" src="../../static/usercenter/wdjs-icon.png"></image>
					<text class="text">我的店长</text>
					<image class="righticon" mode="aspectFill" src="../../static/usercenter/icon_zk.png"></image>
				</view>

			</view>


			<view class="cellbox">
				<view class="cellbox-item" @click="service">
					<image class="lefticon" mode="aspectFit" src="../../static/usercenter/zxkf-icon.png"></image>
					<text class="text">在线客服</text>
					<image class="righticon" mode="aspectFill" src="../../static/usercenter/icon_zk.png"></image>
				</view>
			</view>
		</view>


		<uni-popup ref="popup3" type="bottom">
			<view class="popup-content2">
				<button open-type="contact" class="popup-btn ">在线客服</button>
				<view class="popup-btn " @click="callPhone">官方电话</view>
				<view class="popup-btn" @click="cancel">取消</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import uniPopup from '@/components/uni-popup/uni-popup.vue'

	export default {
		components: {
			uniPopup
		},
		data() {
			return {
				user: {}
			}
		},
		onShow() {
			this.getInfo();
		},
		methods: {

			cancel() {
				this.$refs.popup3.close();
			},
			callPhone() {

				this.$refs.popup3.close();
				uni.makePhoneCall({
					phoneNumber: '073185052195'
				});
			},
			getInfo() {
				let that = this;
				let param = {};
				this.$api.info(param).then(res => {

					console.info(res);
					if (res.code == 1) {
						that.user = res.data;
						if (res.data.shop == null) {
							uni.navigateTo({
								url: './shangjia'
							})
						}
					} else {
						that.$util.$showToast(res.msg, '', 'none');

					}
				})
			},
			service() {
				// uni.makePhoneCall({
				//     phoneNumber: '073185052195'
				// });	
				this.$refs.popup3.open();

			},
			pageTo(url) {
				this.$util.$navigateTo(url);
			}
		}
	}
</script>

<style lang="scss">
	.userinfo {
		background: #37C2BC;
		display: flex;
		height: 174rpx;
		padding: 70rpx 92rpx 70rpx 55rpx;

		.left {
			flex: auto;

			.row01 {
				margin-bottom: 30rpx;

				.name {
					font-size: 48rpx;
					color: #FFFFFF;
				}

				.title {
					height: 30rpx;
					background: linear-gradient(180deg, #37C2BC 0%, #37C2BC 100%);
					border-radius: 24rpx;
					margin-left: 20rpx;
					font-size: 24rpx;
					color: #2D2D2D;
					padding: 0 10rpx;
				}
			}

			.row02 {
				.zhiwei {
					color: #FFFFFF;
					font-size: 24rpx;
				}

				.company {
					color: #FFFFFF;
				}
			}
		}

		.right {
			margin-right: 66rpx;

			image {
				width: 128rpx;
				height: 128rpx;
			}
		}
	}

	.cellboxList {
		border-radius: 20rpx 20rpx 0 0;
		background: #FFFFFF;
		margin-top: -20rpx;
	}

	.cellbox {
		border-bottom: 1rpx solid #EBEBEB;
		margin: 0 40rpx;
		padding: 20rpx 0;

		.cellbox-item {
			display: flex;
			height: 100rpx;
			line-height: 100rpx;

			.lefticon {
				width: 50rpx;
				height: 50rpx;
				margin-top: 25rpx;
			}

			.text {
				flex: auto;
				margin-left: 20rpx;
				font-size: 28rpx;
				color: #333333;
				font-weight: 600;
			}

			.righticon {
				margin-top: 35rpx;
				width: 30rpx;
				height: 30rpx;
			}
		}
	}

	.cellbox:last-child {
		padding-bottom: 100rpx;
		border-bottom: 0rpx;
	}

	.popup-content2 {
		background: #FFFFFF;

		.popup-btn {
			width: 100%;
			height: 100rpx;
			line-height: 100rpx;
			text-align: center;
			border-bottom: 1px solid #f5f5f5;
			background: #FFFFFF;
		}

		button::after {
			border: none;
		}

		.pt20 {
			border-bottom: 20rpx solid #f5f5f5;
		}
	}

	.round {
		width: 128rpx;
		height: 128rpx;
		border-radius: 50%;
		overflow: hidden;
	}
	.popup-content2 {
		background: #FFFFFF;
	
		.popup-btn {
			width: 100%;
			height: 100rpx;
			line-height: 100rpx;
			text-align: center;
			border-bottom: 1px solid #f5f5f5;
			background: #FFFFFF;
		}
	
		button::after {
			border: none;
		}
	
		.pt20 {
			border-bottom: 20rpx solid #f5f5f5;
		}
	}
</style>
